package edu.sjsu.cmpe282.dto;

import edu.sjsu.cmpe282.domain.Catalog;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;

public class CatalogDao {

	Statement stmt = null;
	DBConnection db = new DBConnection();
	Connection conn= db.getConnection();

	public CatalogDao(){}

	public boolean createCatalog(Catalog catalog)
	{
		try {
			stmt = conn.createStatement();
			String query = "INSERT INTO `cloudservices`.`Catalog` (`catalogname`) VALUES ('" + catalog.getCatalogname()+ "');";
			stmt.executeUpdate(query);
		} catch (SQLException e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}finally{
			try {
				conn.close();
			} catch (SQLException e) {
				// TODO Auto-generated catch block
				e.printStackTrace();
			}
		}
		return true;
	}
}

